import sys

# 导入代码需要的模块，就像C++需要添加头文件
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QHBoxLayout, QPushButton, QMessageBox
from PyQt5.QtGui import QIcon


class FirstMainWin(QMainWindow):

    # 构造函数初始化Window
    def __init__(self):
        super(FirstMainWin, self).__init__()

        # 设置主窗口的标题
        self.setWindowTitle('第一个纯Python代码写的主窗口应用')

        # 设置窗口的尺寸
        self.resize(400, 300)

        self.status = self.statusBar()

        self.status.showMessage('我是状态栏消息，5秒后消失', 5000)

        # 添加Button
        self.button1 = QPushButton('AAA')

        # 将信号与槽关联
        self.button1.clicked.connect(self.onClick_Button)

        layout = QHBoxLayout()
        layout.addWidget(self.button1)

        mainFrame = QWidget()
        mainFrame.setLayout(layout)

        self.setCentralWidget(mainFrame)

    # 按钮槽函数
    def onClick_Button(self):
        # 获取触发的对象
        sender = self.sender()
        QMessageBox.information(self, '标题', sender.text() + '按钮被点击了')



class Parent:
    def __init__(self, name):
        self.name = name
        print("parenet init called")

    def say(self):
        print("我是人我的名字:", self.name)

class Son(Parent):
    def __int__(self,name):
        super().__init__(name)




if __name__ == '__main__':
    # app = QApplication(sys.argv)
    #
    # app.setWindowIcon(QIcon('JXC.ico'))
    # main = FirstMainWin()
    # main.show()
    #
    # sys.exit(app.exec_())

    son = Son("ZhangSan")
    son.say()